package com.uzai.console.web.dingding;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.uzai.console.annotation.SystemLogType;
import com.uzai.console.dto.dingding.DingWarningGroupBuyMsgDto;
import com.uzai.console.dto.dingding.DingWarningGroupDto;
import com.uzai.console.dto.dingding.DingWarningGroupQuery;
import com.uzai.console.dto.sysdomain.sysdomaindetail.SysDomainRebuyDto;
import com.uzai.console.enums.OperationTypeEnum;
import com.uzai.console.enums.SystemModelEnum;
import com.uzai.console.service.dingding.DingWarningGroupService;
import com.uzai.console.vo.dingding.DingWarningGroupBuyMsgPriceVo;
import com.uzai.console.vo.dingding.DingWarningGroupBuyMsgVo;
import com.uzai.console.vo.dingding.DingWarningGroupVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "钉钉报警群",tags = "钉钉报警群")
@RestController
public class DingWarningGroupController extends BaseController {

    @Autowired
    private DingWarningGroupService dingWarningGroupService;

    @ApiOperation(value = "查询钉钉报警群", notes = "查询钉钉报警群", response = DingWarningGroupVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/dingWarningGroup/queryByPage")
    public Object queryDingWarningGroup(@RequestBody DingWarningGroupQuery dingWarningGroupQuery){
        return dingWarningGroupService.queryDingWarningGroupByPage(dingWarningGroupQuery);
    }

    @SystemLogType(model = SystemModelEnum.DingWarningGroup, type = OperationTypeEnum.ADD)
    @ApiOperation(value = "新增钉钉报警群", notes = "新增钉钉报警群", response = Boolean.class)
    @ApiOperationSupport(order = 2)
    @PostMapping("/dingWarningGroup/addDingWarningGroup")
    public Object addDingWarningGroup(@RequestBody DingWarningGroupDto dingWarningGroupDto){
        dingWarningGroupService.addDingWarningGroup(dingWarningGroupDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.DingWarningGroup, type = OperationTypeEnum.DELETE)
    @ApiOperation(value = "删除钉钉报警群", notes = "删除钉钉报警群", response = Boolean.class)
    @ApiOperationSupport(order = 4)
    @PostMapping("/dingWarningGroup/deleDingWarningGroup")
    public Object deleDingWarningGroup(@RequestBody  DingWarningGroupDto dingWarningGroupDto){
        dingWarningGroupService.deleDingWarningGroup(dingWarningGroupDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.DingWarningGroup, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "修改钉钉报警群", notes = "修改钉钉报警群", response = Boolean.class)
    @ApiOperationSupport(order = 5)
    @PostMapping("/dingWarningGroup/updateWarningGroup")
    public Object updateWarningGroup(@RequestBody DingWarningGroupDto dingWarningGroupDto){
        dingWarningGroupService.updateWarningGroup(dingWarningGroupDto);
        return true;
    }

    @ApiOperation(value = "查询购买钉钉报警群消息条数价格", notes = "查询购买钉钉报警群消息条数价格", response = DingWarningGroupBuyMsgPriceVo.class)
    @ApiOperationSupport(order = 6)
    @PostMapping("/dingWarningGroup/findBuyMsgPrice")
    public Object findBuyMsgPrice(){
        return dingWarningGroupService.findBuyMsgPrice();
    }

    @SystemLogType(model = SystemModelEnum.DingWarningGroup, type = OperationTypeEnum.BUY)
    @ApiOperation(value = "购买钉钉报警群消息条数", notes = "购买钉钉报警群消息条数",response = DingWarningGroupBuyMsgVo.class)
    @ApiOperationSupport(order = 7)
    @PostMapping("/dingWarningGroup/buyMsg")
    public Object buyMsg(@RequestBody DingWarningGroupBuyMsgDto dingWarningGroupBuyMsgDto){
        return dingWarningGroupService.buyMsg(dingWarningGroupBuyMsgDto);
    }
}
